﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using System.Reflection;

using SpeakupBackend;
using SpeakupBackend.Classes;

namespace Frontend
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        //colors of active classes
        public static readonly Color AvailableColor = Colors.LightGreen;
        public static readonly Color ReservedColor = Color.FromRgb(51, 204, 255);        
        public static readonly Color WaitListColor = Color.FromRgb(150, 150, 150);       
        public static readonly Color UnknownStatusColor = Color.FromRgb(200, 200, 200);

        //colors for highlighted classes
        public static readonly Color HighlightColor = Colors.Orange;
        public static readonly Color HighlightWaitListColor = Colors.OrangeRed;
        public static readonly Color HighlightUnknownStatusColor = Colors.Pink;

        public static readonly string AvailableBrushKey = "AvailableBrush";
        public static readonly string ReservedBrushKey  = "ReservedBrush";
        public static readonly string AvailableWaitListBrushKey = "AvailableWaitListBrush";
        public static readonly string ReservedWaitListBrushKey = "ReservedWaitListBrush";
        public static readonly string UnknownStatusBrushKey = "UnknownStatusBrush";

        public static readonly string HighlightedAvailableBrushKey = "HighlightedAvailableBrush";
        public static readonly string HighlightedReservedBrushKey = "HighlightedReservedBrush";
        public static readonly string HighlightedAvailableWaitListBrushKey = "HighlightedAvailableWaitListBrush";
        public static readonly string HighlightedReservedWaitListBrushKey = "HighlightedReservedWaitListBrush";
        public static readonly string HighlightedUnknownStatusBrushKey = "HighlightedUnknownStatusBrush";        

        static public Brush GetClassBrush(ClassStatus status)
        {
            switch (status)
            {
                case ClassStatus.Available:
                    return (Brush)Application.Current.Resources[App.AvailableBrushKey];

                case ClassStatus.Reserved:
                    return (Brush)Application.Current.Resources[App.ReservedBrushKey];

                case ClassStatus.AvailableWaitList:
                    return (Brush)Application.Current.Resources[App.AvailableWaitListBrushKey];

                case ClassStatus.ReservedWaitList:
                    return (Brush)Application.Current.Resources[App.ReservedWaitListBrushKey];

                default:
                    return (Brush)Application.Current.Resources[App.UnknownStatusBrushKey];
            }
        }

        static public Brush GetHighlightedClassBrush(ClassStatus status)
        {
            switch (status)
            {
                case ClassStatus.Available:
                    return (Brush)Application.Current.Resources[App.HighlightedAvailableBrushKey];

                case ClassStatus.Reserved:
                    return (Brush)Application.Current.Resources[App.HighlightedReservedBrushKey];

                case ClassStatus.AvailableWaitList:
                    return (Brush)Application.Current.Resources[App.HighlightedAvailableWaitListBrushKey];

                case ClassStatus.ReservedWaitList:
                    return (Brush)Application.Current.Resources[App.HighlightedReservedWaitListBrushKey];

                default:
                    return (Brush)Application.Current.Resources[App.HighlightedUnknownStatusBrushKey];
            }
        }

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
        }

    }
}
